#!/bin/sh

# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved.

DIR=@CMAKE_INSTALL_PREFIX@/xrt/
#create sym link to @CMAKE_INSTALL_PREFIX@/xrt/lib/libmpd_plugin and restart mpd service
echo "Install azure mpd plugin"
rm -rf $DIR/lib/libmpd_plugin.so > /dev/null 2>&1
ln -s $DIR/lib/libazure_mpd_plugin.so $DIR/lib/libmpd_plugin.so
#make sure mpd automatically gets starts across reboot if plugin is installed
systemctl enable mpd
echo "Restart mpd service"
systemctl restart mpd

exit 0
